using NeosSDI.Core.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NeosSDI.Core.Tools
{
    public class NavigationHistory
    {
        /// <summary>
        /// Use case
        /// </summary>
        public UseCase UseCase { get; set; }

        /// <summary>
        /// Namespace of the controller
        /// </summary>
        public string ControllerNamespace { get; set; }

        /// <summary>
        /// Description of the action
        /// </summary>
        public string ActionMethod { get; set; }

        /// <summary>
        /// List of action parameters
        /// </summary>
        public IDictionary<string, object> ActionParameters { get; set; }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            if (UseCase != null)
            {
                sb.AppendLine("UseCase: " + UseCase.Name + ", " + UseCase.Details);
            }
            else
            {
                sb.AppendLine("UseCase: Undefined");
            }
            sb.AppendLine("Controller: " + ControllerNamespace);
            sb.AppendLine("ActionMethod: " + ActionMethod);
            sb.AppendLine("ActionParameters: ");
            foreach (var item in ActionParameters)
            {
                if (item.Value != null)
                {
                    sb.AppendLine(" -" + item.Key + ": " + item.Value.ToString());
                }
            }

            string spacer = new String('-', 20);
            sb.AppendLine(spacer);

            return sb.ToString();
        }
    }
}
